﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace NewChillers.Styles.Custom
{
    public class UButton : Button
    {
        // 依赖属性 圆角 具备自动通知界面的能力
        public CornerRadius ButtonCornerRadius
        {
            get { return (CornerRadius)GetValue(ButtonCornerRadiusProperty); }
            set { SetValue(ButtonCornerRadiusProperty, value); }
        }
        // Using a DependencyProperty as the backing store for ButtonCornerRadius.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty ButtonCornerRadiusProperty =
            DependencyProperty.Register("ButtonCornerRadius", typeof(CornerRadius), typeof(UButton));

        // 重要 重要 重要 误删
        static UButton()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(UButton),
                new FrameworkPropertyMetadata(typeof(UButton)));
        }

        // 鼠标悬停
        public Brush BackgroundHover
        {
            get { return (Brush)GetValue(BackgroundHoverProperty); }
            set { SetValue(BackgroundHoverProperty, value); }
        }
        public static readonly DependencyProperty BackgroundHoverProperty =
            DependencyProperty.Register("BackgroundHover", typeof(Brush), typeof(UButton),
                new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#006CC0"))));

        // 鼠标按下
        public Brush BackgroundPressed
        {
            get { return (Brush)GetValue(BackgroundPressedProperty); }
            set { SetValue(BackgroundPressedProperty, value); }
        }
        public static readonly DependencyProperty BackgroundPressedProperty =
            DependencyProperty.Register("BackgroundPressed", typeof(Brush), typeof(UButton),
                new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#005AA3"))));
    }
}
